

import Dept from "./Dept"
import { BaseTable } from "@xuekl/cli-core/builder"
import { Operation } from "@xuekl/cli-core/helper"
import { TableColumn, TableOperation } from "@xuekl/cli-core/types"

export default class DeptTable extends BaseTable<Dept> implements Operation {
    operation: TableOperation = {
        label: '操作',
        width: 100
    }
    columns: TableColumn<Dept>[] = [
        {
            prop: 'deptName',
            label: '部门名称'
        },
        {
            prop: 'orderNum',
            label: '显示排序'
        },
        {
            prop: 'leader',
            label: '负责人'
        },
        {
            prop: 'status',
            label: '部门状态',
            tags: [{ value: '0', type: 'primary' }, { value: '1', type: 'danger' }],
            dict: 'sys_normal_disable'
        },
    ]

    constructor() {
        super()
        this.element.rowKey = 'deptId'
        this.element.treeProps = {
            hasChildren: 'hasChildren',
            children: 'children'
        }
    }
}